<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="gdufs.stat.service.vo.LoanInfo"%>
<%@page import="java.util.List"%>
<%@page import="gdufs.stat.service.Utils"%>
<%@page import="gdufs.stat.service.LibraryQuery"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<html>
<head>
<%@include file="/inc/head.jsp" %>
<title>借书信息</title>
<style type="text/css">
.expried{
	color: red;
}

</style>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
	<td>
	<%
	ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(application); 
	LibraryQuery libraryQuery = (LibraryQuery)context.getBean("libraryQuery");
	List<LoanInfo> loanInfos = libraryQuery.queryLoanInfo(Utils.getCurrentUserId(request));
	if(loanInfos!=null && loanInfos.size()>0){
	%>
		<div id="msg">您已借阅<font color="red"><%=loanInfos.size() %></font>册，最近到期<font color="red"><%=DateFormatUtils.format(loanInfos.get(0).getDueDate(),"yyyy年MM月dd日")%></font></div>
	<%}else{%>
		<div id="msg">您目前没有借书。</div>
	<%}%>
	</td>
	<td align="right"><a href="http://tsg.gdufs.edu.cn/gwd_local/login_ibm.jsp" target="_blank">查看更多</a></td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="5" border="1" bordercolor="#cccccc" style="border: 1px solid #cccccc;border-collapse: collapse;">
	<tr>
		<th>
		 书名
		</th>
		<th width="90">
		到期日期
		</th>
		
	</tr>
	<%for(int i=0;i<loanInfos.size();i++){ %>
	<tr <%if(loanInfos.get(i).isExpired())out.print("class='expried'"); %>>
		<td><%=loanInfos.get(i).getTitle() %></td>
		<td><%=DateFormatUtils.format(loanInfos.get(i).getDueDate(),"yyyy年MM月dd日")%></td>
	</tr>
	<%
		if(i==3){
			break;
		}
	} %>
</table>
</body>
</html>